package com.ty.day1.home;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/14 18:29
 */
public class Calculate {
    public void division(Double a, Double b, char symbol) {
        switch (symbol) {
            case '+':
                System.out.println(a + b);
                break;
            case '-':
                System.out.println(a - b);
                break;
            case '*':
                System.out.println(a * b);
                break;
            case '/':
                System.out.println(a / b);
                break;
            case '%':
                System.out.println(a % b);
                break;
            default:
                System.out.println("符号错误");
                break;
        }
    }

    public void division(Float a, Float b, char symbol) {
        division((double) a, (double) b, symbol);
    }

    public void division(Integer a, Integer b, char symbol) {
        division((long) a, (long) b, symbol);
    }

    public void division(Short a, Short b, char symbol) {
        division((long) a, (long) b, symbol);
    }

    public void division(Byte a, Byte b, char symbol) {
        division((long) a, (long) b, symbol);
    }

    public void division(Long a, Long b, char symbol) {
        switch (symbol) {
            case '+':
                System.out.println(a + b);
                break;
            case '-':
                System.out.println(a - b);
                break;
            case '*':
                System.out.println(a * b);
                break;
            case '/':
                System.out.println(a / b);
                break;
            case '%':
                System.out.println(a % b);
                break;
            default:
                System.out.println("符号错误");
                break;
        }
    }
}
